import request from "@/utils/request.js";
/**
 * 公共接口 ，优惠券接口 , 行业此讯 , 手机号码注册
 * 
*/

/**
 * 获取主页数据 无需授权
 * 
*/
export function getIndexData()
{
  return request.get("index",{},{ noAuth : true});
}

/**
 * 获取登录授权login
 * 
*/
export function getLogo()
{
  return request.get('wechat/getLogo', {}, { noAuth : true});
}


/**
 * 保存form_id
 * @param string formId 
 */
export function setFormId(formId) {
  return request.post("wechat/set_form_id", { formId: formId});
}

/**
 * 领取优惠卷
 * @param int couponId
 * 
*/
export function setCouponReceive(couponId){
  return request.post('coupon/receive', { couponId: couponId});
}
/**
 * 优惠券列表
 * @param object data
*/
export function getCoupons(data){
  return request.get('coupons',data,{noAuth:true})
}

/**
 * 我的优惠券
 * @param int types 0全部  1未使用 2已使用
*/
export function getUserCoupons(data){
  return request.get('coupon/list',data,{ noAuth: false })
}

/**
 * 文章分类列表
 * 
*/
export function getArticleCategoryList(){
  return request.get('article/category/list',{},{noAuth:true})
}

/**
 * 文章列表
 * @param int cid
 * 
*/
export function getArticleList(cid,data){
  return request.get('article/list/' + cid, data,{noAuth:true})
}

/**
 * 文章 热门列表
 * 
*/
export function getArticleHotList(){
  return request.get('article/hot/list',{},{noAuth:true});
}

/**
 * 文章 轮播列表
 * 
*/
export function getArticleBannerList(){
  return request.get('article/banner/list',{},{noAuth:true})
}

/**
 * 文章详情
 * @param int id 
 * 
*/
export function getArticleDetails(id){
  return request.get('article/info',id,{noAuth:true});
}

/**
 * 手机号+验证码登录接口
 * @param object data
*/
export function loginMobile(data){
  return request.post('login/mobile',data,{noAuth:true})
}

/**
 * 获取短信KEY
 * @param object phone
*/
export function verifyCode(){
  return request.get('verify_code', {},{noAuth:true})
}

/**
 * 验证码发送
 * @param object phone
*/
export function registerVerify(phone){
  return request.post('sendCode', { phone: phone },{noAuth:true},1)
}

/**
 * 手机号注册
 * @param object data
 * 
*/
export function phoneRegister(data){
  return request.post('register',data,{noAuth:true});
}

/**
 * 手机号修改密码
 * @param object data
 * 
*/
export function phoneRegisterReset(data){
  return request.post('register/reset',data,{noAuth:true})
}

/**
 * 手机号+密码登录
 * @param object data
 * 
*/
export function phoneLogin(data){
  return request.post('login',data,{noAuth:true})
}

/**
 * 切换H5登录
 * @param object data
*/
// #ifdef MP
export function switchH5Login(){
  return request.post('switch_h5', { 'from':'routine'});
}
// #endif

/*
 * h5切换公众号登录
 * */
// #ifdef H5
export function switchH5Login() {
  return request.post("switch_h5", { 'from': "wechat" });
}
// #endif

/**
 * 换绑手机号
 * 
*/
export function bindingPhone(data){
  return request.post('update/binding',data);
}

/**
 * 换绑手机号校验
 * 
*/
export function bindingVerify(data){
  return request.post('update/binding/verify',data,{ noAuth: false });
}

/**
 * 退出登錄
 * 
*/
export function logout(){
  return request.get('logout');
}

/**
 * 获取订阅消息id
 */
export function getTemlIds(data)
{
  return request.get('wechat/program/my/temp/list', data , { noAuth:true});
}

/**
 * 首页拼团数据
 */
export function pink()
{
  return request.get('pink', {}, { noAuth:true});
}

/**
 * 获取城市信息
 */
export function getCity() {
  return request.get('city/list', { }, { noAuth: true });
}

/**
 * 获取小程序直播列表
 */
export function getLiveList(page,limit) {
  return request.get('wechat/live', { page, limit}, { noAuth: true });
}

/**
 * 获取小程序二维码
 */
export function getQrcode(data) {
  return request.post('qrcode/get',data,{ noAuth: true });
}

/**
 * 反馈
 */
export function feedback(data) {
  return request.post('feedback/save',data,{ noAuth: false });
}
/**
 * 兑换次数
 */
export function timeExchange(data) {
  return request.post('activity/draw/timeExchange' + '?time=' + data.time,data);
}
// 获取消息列表
export const getNoticeListData = (data) => {
  return request.get('message/list',data,{ noAuth: false });
}
// 修改已读
export const readData = (data) => {
  return request.post('message/read',data,{ noAuth: false });
}
// 意见反馈
export const postOptionData = (data) => {
  return request.post('feedback/save',data,{ noAuth: false });
}

// 保存用户信息
export const postUserInfoData = (data) => {
  return request.post('user/edit',data,{ noAuth: false });
}

// 获取我的页面头部订单
export const getOrderNumData = (data) => {
  return request.get('order/data',data,{ noAuth: false });
}

// 获取订单列表
export const getOrderListData = (data) => {
  return request.get('order/list',data,{ noAuth: false });
}

// 确认收货
export const queryOrderData = (data) => {
  return request.post('order/take?id=' + data.id,data,{ noAuth: false });
}

// 取消订单
export const postOrderCancelData = (data) => {
  return request.post('order/cancel?id=' + data.id,data,{ noAuth: false });
}


// 订单详情
export const getOrderDetail = (id) => {
  return request.get( "order/detail/" + id,  {}, { noAuth: false });
}


// 获取核销二维码
export const postOrderCodeData = (data) => {
  return request.post('qrcode/order2base64',data,{ noAuth: false, isForm: true });
}
//// 余额兑换积分
export const integralExchange = (data) => {
  return request.post('integral/exchange',data,{ noAuth: false, isForm: true });
}
// 创建积分订单
export const orderExchange = (data) => {
  return request.post('order/exchange',data,{ noAuth: false });
}
// 查询积分订单
export const orderExchangeList = (data) => {
  return request.get('order/exchangeOrderList',data,{ noAuth: false });
}

// 签到
// 获取配置
export const getSignConfig = (data) => {
  return request.get('user/sign/config',data,{ noAuth: true });
}
// 今日详情 user/sign/get
export const getDaySign = (data) => {
  return request.get('user/sign/get',data,{ noAuth: true });
}
// 签到
export const getIntegralSign = (data) => {
  return request.get('user/sign/integral',data,{ noAuth: true });
}
// 签到用户信息
export const postSignUser = () => {
  return request.post( "user/sign/user",  {}, { noAuth: true });
}
// 分页列表 user/sign/list
export const getIntegralList = (data) => {
  return request.get('user/sign/list',data,{ noAuth: true });
}

export const wxcode = (data) => {
  return request.post( "wechat/wxaCode",  data, { noAuth: true });
}

// 任务列表 mission/list
export const getMissionList = (data) => {
  return request.get('mission/list',data,{ noAuth: true });
}
// mission/missionDetail
export const getMissionDetail = (data) => {
  return request.get('mission/missionDetail',data,{ noAuth: true });
}

// 进行中列表
export const getUserMissionList = (data) => {
  return request.get('mission/missionList',data,{ noAuth: true });
}
// 领取奖励
export const getUserMissionReceiveAward = (data) => {
  return request.get('mission/receiveAward',data,{ noAuth: true });
}

// 提交浏览记录
export const postMissionRecord = (data) => {
  return request.post('mission/submitView',data,{ noAuth: true });
}
// 用户浏览列表 mission/viewList
export const getUserViewList = (data) => {
  return request.get('mission/viewListAll',data,{ noAuth: true });
}
// 列表 mission/list
export const getMissionListNew = (data) => {
  return request.get('mission/list',data,{ noAuth: true });
}
//浏览详情

export const getMissionDetailNew = (id) => {
  return request.get( "mission/info/" + id,  {}, { noAuth: true });
}

//yue/billList
export const yueBillList = (data) => {
  return request.get( "yue/billList",  data, { noAuth: false });
}

// yue/extractApply
export const yueExtractApply = (data) => {
  return request.post( "yue/extractApply",  data, { noAuth: false });
}

//yue/extractList

export const yueExtractList = (data) => {
  return request.get( "yue/extractList",  data, { noAuth: false });
}
export const xieyi = (id) => {
  return request.get( 'article/info?id=' + id,  {}, { noAuth: false })
}